import java.util.Arrays;

/**
 * @Author YuanYuan
 * @Date 2022/4/30
 * @Time 18:16
 */
public class TestDemo {
    public static void func1(int[] array) {
        array = new int[]{1,2,3};
    }
    public static void func2(int[] array) {
        array[0] = 99;
    }

    public static void main(String[] args) {
        int[] array = {9,8,7};
        func1(array);
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+ " ");
        }
        System.out.println();
        System.out.println("===========");
        func2(array);
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+ " ");
        }
        System.out.println();


    }
    public static void main13(String[] args) {
        int[] arr3 = null;
        System.out.println(arr3[1]);

    }
    public static void main12(String[] args) {
        int[] arr3 = null;
        System.out.println(arr3.length);

    }
    public static void func() {
        int[] array1 = new int[3];
        array1[0] = 10;
        array1[1] = 20;
        array1[2] = 30;
        int[] array2 = new int[]{1,2,3,4,5};
        array2[0] = 100;
        array2[1] = 200;
        array1 = array2;
        array1[2] = 300;
        array1[3] = 400;
        array2[4] = 500;
        for (int i = 0; i < array2.length; i++) {
            System.out.println(array2[i]);
        }
    }
    public static void main11(String[] args) {
        func();
    }
    public static void main10(String[] args) {
        int a = 10;
        int b = 20;
        int[] arr = {1,2,3,4,5};
    }
    public static void main9(String[] args) {
        int[] arr = {1,2,3,4,5};
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]);

        }
        System.out.println();
        System.out.println("=============for each ===========");
        for(int x : arr) {
            System.out.print(x);
        }
        System.out.println();
        System.out.println("=============for Arrays toString ===========");
        String ret = Arrays.toString(arr);
        System.out.print(ret);
    }
    public static void main8(String[] args) {
        int[] arr = {1,2,3,4,5};
        //arr = {2,3,4,5};
        arr = new int[]{2,3,4,5};
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]);
        }
    }
    public static void main7(String[] args) {
        int[] arr = {1,2,3,4,5};
        int len = arr.length;
        System.out.println(len);
    }
    public static void main6(String[] args) {
        int[] arr = {1,2,3,4,5};
        System.out.println(arr[0]);
        arr[0] = 9;
        System.out.println(arr[0]);
    }
    public static void main5(String[] args) {
        int[] arr = {1,2,3,4,5};
        System.out.println(arr);
    }
    public static void main4(String[] args) {
        int[] arr = new int[5];
    }
    public static void main3(String[] args) {
        int[] arr = new int[]{1,2,3,4,5};
    }
    public static void main2(String[] args) {
        int[] arr = {1,2,3,4,5};
    }
    public static void main1(String[] args) {
        int a = 8;
        int b = 6;
        int c = 9;
    }
}
